package com.web.exiaodao.business.entity;

import com.web.exiaodao.business.constant.JConstant;
import com.web.exiaodao.remote.vo.AddressVo;
import com.web.webstart.base.entity.BaseEntity;
import com.web.webstart.base.util.XaUtil;
import com.wordnik.swagger.annotations.ApiModel;
import com.wordnik.swagger.annotations.ApiModelProperty;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @author eason
 * @ClassName: order
 * @Description: 商品-订单表定义表
 * 严格意义上，订单里面不能有引用，直接把内容存进去
 * @date 2016-11-03 10:54:30
 */
@Entity
@Table(name = "tb_xa_order")
@ApiModel(value = "商品-订单表定义表")
public class Order extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "购买人ID,购买人ID")
    private Long userId;
    @ApiModelProperty(value = "主订单编号,主订单编号(16位)")
    private String orderNo;
    @ApiModelProperty(value = "订单付款时间,订单付款时间")
    private String order_PAY_DateTime;
    @ApiModelProperty(value = "订单发货时间,订单发货时间")
    private String order_DeliverGoods_DateTime;
    @ApiModelProperty(value = "订单成交时间,订单成交时间")
    private String order_Sucess_DateTime;
    @ApiModelProperty(value = "订单评论时间,订单评论时间")
    private String orderReceivingDatetime;
    @ApiModelProperty(value = "订单失效时间,Order-Dead-DateTime")
    private String order_Dead_DateTime;
    @ApiModelProperty(value = "给卖家留言,给卖家留言")
    private String leaveMsg;
    /**
     * 参见 {@link JConstant.OrderStatus}
     */
    @ApiModelProperty(value = "订单状态,订单状态")
    private String orderState;
    @ApiModelProperty(value = "支付种类,支付种类，下订单的时候为空（0：微信 1：支付宝 2：银联 3：钱包）")
    private Integer paymentKind;
    @ApiModelProperty(value = "物流公司,物流公司")
    private String expressCompany;
    @ApiModelProperty(value = "物流运单号,物流运单号")
    private String expressNumber;

    @ApiModelProperty(value = "订单有效期,订单有效期")
    private String orderVilidaty;
    /**
     * 参见 {@link JConstant.Order_CommentType}
     */
    @ApiModelProperty(value = "订单类型(1：普通商品  2:兑换商品  3：玩 /达人/作品/艺术品   51:住； 52:机构参观  53：旅游/游学     62:家政护理; 63:医疗服务|医疗康复; 64:护理培训|培训义工),订单类型(1：普通商品  2:兑换商品  3：玩 /达人/作品/艺术品   51:住； 52:机构参观  53：旅游/游学     62:家政护理; 63:医疗服务|医疗康复; 64:护理培训|培训义工) ")
    private String orderType;

    /**
     * 商品专用
     */
    @ApiModelProperty(value = "邮费，默认0.00,邮费，默认0.00'")
    private Double postage;
    @ApiModelProperty(value = "积分或者亲和币抵扣金额(亲币数量或者积分数量),积分或者亲和币抵扣金额")
    private Integer deducted_money;
    @ApiModelProperty(value = "商品总价,商品总价，不包含运费,运费险之类和不优惠之前的")
    private Double goodsTotalPrices;
    @ApiModelProperty(value = "订单总价,订单总价，多件商品（商品总价+运费-抵扣）")
    private Double orderTotalPirce;


    @ApiModelProperty(value = "选择的规格Ids,选择的规格Ids;用逗号分割")
    private String standardIds;
    /**
     * 服务类订单用
     */
    @ApiModelProperty(value = "服务类专用-对象Id,服务类专用-对象Id")
    private Long service_object_id;
    @ApiModelProperty(value = "服务类专用-商品数量,服务类专用-商品数量")
    private Long service_num;
    @ApiModelProperty(value = "服务类专用-单价,服务类专用-单价")
    private Double service_price;
    @ApiModelProperty(value = "服务类专用-联系人,服务类专用-联系人")
    private String service_userName;
    @ApiModelProperty(value = "服务类专用-手机号,服务类专用-手机号")
    private String service_phone;
    @ApiModelProperty(value = "服务类专用-身份证号,服务类专用-身份证号")
    private String service_idCard;
    @ApiModelProperty(value = "服务专用-预约服务时间,服务专用-预约服务时间")
    private String service_appointment_time;

    /**
     * 住 用
     */
    @ApiModelProperty(value = "酒店房间预约入住时间(单位天),酒店房间预约入住时间(单位天)")
    private String hourse_checkinTime;
    @ApiModelProperty(value = "入住时长（单位：天,入住时长（单位：天")
    private Integer hourse_checkin_duration;
    @ApiModelProperty(value = "入住时长单位（取值：天,月）")
    private String hourse_checkin_duration_unit;

    /**
     * 机构参观专用
     */
    @ApiModelProperty(value = "机构专用-参观目的,机构专用-参观目的")
    private String insVisitPurpose;
    @ApiModelProperty(value = "机构专用-参观公司,机构专用-参观公司")
    private String insVisitCompany;

    /**
     * 地址
     * addressId  只保存地址id不行,当地址信息被修改或者删除的时候,会出问题
     * 参加 {@link Address}
     */
    @ApiModelProperty(value = "收货地址id,保存id,当地址信息被修改或者删除的时候")
    private String addressId;
    @ApiModelProperty(value = "收货人姓名,收货人姓名")
    private String consigneeName;
    @ApiModelProperty(value = "收货人电话,收货人电话")
    private String consigneeTel;
    @ApiModelProperty(value = "收货人地址,收货人地址")
    private String consigneeAdress;

    /**
     * 发票信息
     */
    @ApiModelProperty(value = "发票种类（1：个人 2:公司）")
    private Integer billType;
    @ApiModelProperty(value = "发票类型（1：纸质发票 2:电子发票）")
    private Integer billEtype;
    @ApiModelProperty(value = "发票抬头")
    private String billTitle;
    @ApiModelProperty(value = "发票内容（如：明细;食品）")
    private String billContent;

    @ApiModelProperty(value = "线下支付的价格=总金额-定金")
    private Double offlinePrices;


    /**
     * 退款专用
     * trade_no即queryId  支付宝交易号(退款用)
     * refuOrderNo out_refund_no 微信退款专用
     * @see TradeRecord
     * @see Returnshoprecord
     * @see JConstant.OrderRefundStatus
     */
    @ApiModelProperty(value="交易流水号,交易流水号")
    private String queryId;
    @ApiModelProperty(value="退款订单号,退款订单号(10位)")
    private String refuOrderNo;
    @ApiModelProperty(value="退款状态,退款状态")
    private Integer refundStatus;

    public Order() {
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    @Column(nullable = true, length = 50)
    public Long getUserId() {
        return userId;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    @Column(nullable = true, length = 50)
    public String getOrderNo() {
        return orderNo;
    }

    public void setOrder_PAY_DateTime(String order_PAY_DateTime) {
        this.order_PAY_DateTime = order_PAY_DateTime;
    }

    @Column(nullable = true, length = 50)
    public String getOrder_PAY_DateTime() {
        return order_PAY_DateTime;
    }

    public void setOrder_DeliverGoods_DateTime(String order_DeliverGoods_DateTime) {
        this.order_DeliverGoods_DateTime = order_DeliverGoods_DateTime;
    }

    @Column(nullable = true, length = 50)
    public String getOrder_DeliverGoods_DateTime() {
        return order_DeliverGoods_DateTime;
    }

    public void setOrder_Sucess_DateTime(String order_Sucess_DateTime) {
        this.order_Sucess_DateTime = order_Sucess_DateTime;
    }

    @Column(nullable = true, length = 50)
    public String getOrder_Sucess_DateTime() {
        return order_Sucess_DateTime;
    }

    public void setOrderReceivingDatetime(String orderReceivingDatetime) {
        this.orderReceivingDatetime = orderReceivingDatetime;
    }

    @Column(nullable = true, length = 50)
    public String getOrderReceivingDatetime() {
        return orderReceivingDatetime;
    }

    public void setOrder_Dead_DateTime(String order_Dead_DateTime) {
        this.order_Dead_DateTime = order_Dead_DateTime;
    }

    @Column(nullable = true, length = 50)
    public String getOrder_Dead_DateTime() {
        return order_Dead_DateTime;
    }

    public void setOrderState(String orderState) {
        this.orderState = orderState;
        if (this.orderState == null) {
            this.orderState = JConstant.OrderStatus.UN_PAY + "";
        }
    }

    @Column(nullable = true, length = 50)
    public String getOrderState() {
        return orderState;
    }

    public void setPaymentKind(Integer paymentKind) {
        this.paymentKind = paymentKind;
    }

    @Column(nullable = true, length = 50)
    public Integer getPaymentKind() {
        return paymentKind;
    }

    public void setOrderTotalPirce(Double orderTotalPirce) {
        this.orderTotalPirce = orderTotalPirce;
    }

    @Column(nullable = true, length = 50)
    public Double getOrderTotalPirce() {
        return orderTotalPirce;
    }

    public void setPostage(Double postage) {
        this.postage = postage;
    }

    @Column(nullable = true, length = 50)
    public Double getPostage() {
        return postage;
    }

    public void setDeducted_money(Integer deducted_money) {
        this.deducted_money = deducted_money;
    }

    @Column(nullable = true, length = 50)
    public Integer getDeducted_money() {
        return deducted_money;
    }

    public void setExpressCompany(String expressCompany) {
        this.expressCompany = expressCompany;
    }

    @Column(nullable = true, length = 50)
    public String getExpressCompany() {
        return expressCompany;
    }

    public void setExpressNumber(String expressNumber) {
        this.expressNumber = expressNumber;
    }

    @Column(nullable = true, length = 50)
    public String getExpressNumber() {
        return expressNumber;
    }


    public void setOrderVilidaty(String orderVilidaty) {
        this.orderVilidaty = orderVilidaty;
    }

    @Column(nullable = true, length = 50)
    public String getOrderVilidaty() {
        return orderVilidaty;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    @Column(nullable = true, length = 50)
    public String getOrderType() {
        return orderType;
    }

    public void setService_object_id(Long service_object_id) {
        this.service_object_id = service_object_id;
    }

    @Column(nullable = true, length = 50)
    public Long getService_object_id() {
        return service_object_id;
    }

    public void setService_num(Long service_num) {
        this.service_num = service_num;
    }

    @Column(nullable = true, length = 50)
    public Long getService_num() {
        return service_num;
    }

    public void setService_price(Double service_price) {
        this.service_price = service_price;
    }

    @Column(nullable = true, length = 50)
    public Double getService_price() {
        return service_price;
    }

    public void setService_userName(String service_userName) {
        this.service_userName = service_userName;
    }

    @Column(nullable = true, length = 50)
    public String getService_userName() {
        return service_userName;
    }

    public void setService_phone(String service_phone) {
        this.service_phone = service_phone;
    }

    @Column(nullable = true, length = 50)
    public String getService_phone() {
        return service_phone;
    }

    public void setService_idCard(String service_idCard) {
        this.service_idCard = service_idCard;
    }

    @Column(nullable = true, length = 50)
    public String getService_idCard() {
        return service_idCard;
    }

    public void setService_appointment_time(String service_appointment_time) {
        this.service_appointment_time = service_appointment_time;
    }

    @Column(nullable = true, length = 50)
    public String getService_appointment_time() {
        return service_appointment_time;
    }

    @Column(nullable = true, length = 50)
    public String getHourse_checkinTime() {
        return hourse_checkinTime;
    }

    public void setHourse_checkinTime(String hourse_checkinTime) {
        this.hourse_checkinTime = hourse_checkinTime;
    }

    @Column(nullable = true, length = 50)
    public Integer getHourse_checkin_duration() {
        return hourse_checkin_duration;
    }

    public void setHourse_checkin_duration(Integer hourse_checkin_duration) {
        this.hourse_checkin_duration = hourse_checkin_duration;
    }

    @Column(nullable = true, length = 50)
    public String getHourse_checkin_duration_unit() {
        return hourse_checkin_duration_unit;
    }

    public void setHourse_checkin_duration_unit(String hourse_checkin_duration_unit) {
        this.hourse_checkin_duration_unit = hourse_checkin_duration_unit;
    }

    @Column(nullable = true, length = 50)
    public String getInsVisitPurpose() {
        return insVisitPurpose;
    }

    public void setInsVisitPurpose(String insVisitPurpose) {
        this.insVisitPurpose = insVisitPurpose;
    }

    @Column(nullable = true, length = 50)
    public String getInsVisitCompany() {
        return insVisitCompany;
    }

    public void setInsVisitCompany(String insVisitCompany) {
        this.insVisitCompany = insVisitCompany;
    }

    @Column(nullable = true, length = 255)
    public String getStandardIds() {
        return standardIds;
    }

    public void setStandardIds(String standardIds) {
        this.standardIds = standardIds;
    }

    @Column(nullable = true, length = 50)
    public Double getGoodsTotalPrices() {
        return goodsTotalPrices;
    }

    public void setGoodsTotalPrices(Double goodsTotalPrices) {
        this.goodsTotalPrices = goodsTotalPrices;
    }

    @Column(nullable = true, length = 50)
    public String getLeaveMsg() {
        return leaveMsg;
    }

    public void setLeaveMsg(String leaveMsg) {
        this.leaveMsg = leaveMsg;
    }

    @Column(nullable = true, length = 50)
    public String getConsigneeName() {
        return consigneeName;
    }

    public void setConsigneeName(String consigneeName) {
        this.consigneeName = consigneeName;
    }

    @Column(nullable = true, length = 50)
    public String getConsigneeTel() {
        return consigneeTel;
    }

    public void setConsigneeTel(String consigneeTel) {
        this.consigneeTel = consigneeTel;
    }

    @Column(nullable = true, length = 500)
    public String getConsigneeAdress() {
        return consigneeAdress;
    }

    public void setConsigneeAdress(String consigneeAdress) {
        this.consigneeAdress = consigneeAdress;
    }

    @Column(nullable = true, length = 50)
    public String getAddressId() {
        return addressId;
    }

    public void setAddressId(String addressId) {
        this.addressId = addressId;
    }

    public void setAddressInfo(AddressVo addressVo) {
        if (XaUtil.isNotEmpty(addressVo)) {
            this.addressId = addressVo.getId() + "";
            this.consigneeName = addressVo.getConsigneeName();
            this.consigneeTel = addressVo.getMobile();
            this.consigneeAdress = addressVo.getAddressDetail();
        }
    }

    @Column(nullable = true, length = 50)
    public Integer getBillType() {
        return billType;
    }

    public void setBillType(Integer billType) {
        this.billType = billType;
    }

    @Column(nullable = true, length = 255)
    public String getBillTitle() {
        return billTitle;
    }

    public void setBillTitle(String billTitle) {
        this.billTitle = billTitle;
    }

    @Column(nullable = true, length = 50)
    public String getBillContent() {
        return billContent;
    }

    public void setBillContent(String billContent) {
        this.billContent = billContent;
    }

    public Integer getBillEtype() {
        return billEtype;
    }

    public void setBillEtype(Integer billEtype) {
        this.billEtype = billEtype;
    }

    @Column(nullable = true, length = 50)
    public Double getOfflinePrices() {
        return offlinePrices;
    }

    public void setOfflinePrices(Double offlinePrices) {
        this.offlinePrices = offlinePrices;
    }

    @Column(nullable = true, length = 50)
    public String getQueryId() {
        return queryId;
    }

    public void setQueryId(String queryId) {
        this.queryId = queryId;
    }

    @Column(nullable = true, length = 50)
    public String getRefuOrderNo() {
        return refuOrderNo;
    }

    public void setRefuOrderNo(String refuOrderNo) {
        this.refuOrderNo = refuOrderNo;
    }

    /**
     * @see JConstant.OrderRefundStatus
     * @return
     */
    @Column(nullable = true, length = 50)
    public Integer getRefundStatus() {
        return refundStatus;
    }

    public void setRefundStatus(Integer refundStatus) {
        this.refundStatus = refundStatus;
    }
}
